package cn.kgc.controller;

import cn.kgc.entities.Emp;
import cn.kgc.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
public class EmpController {
    @Autowired
    public RedisTemplate redisTemplate;

    @Autowired
    private EmpService empService;

    @PostMapping("/emp")
    public String addEmp(@RequestBody Emp emp) {
        empService.add(emp);
        return "add ok";
    }

    @GetMapping("/emp/{id}")
    public Object getEmpById(@PathVariable("id") Integer id) {
        return empService.getEmpById(id);
    }
}
